var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
// 类
var Animal = /** @class */ (function () {
    function Animal(name, sex, age) {
        this.name = name;
        this.sex = sex;
        this.age = age;
    }
    Animal.prototype.move = function (distance) {
        if (distance === void 0) { distance = 23; }
        return "my name is " + this.name + "\uFF0Ci am " + this.age + " years old\uFF0Cmove " + distance + "m";
    };
    return Animal;
}());
var snake = new Animal('snake', '男', 18);
console.log(snake.name);
console.log(snake.move());
console.log(snake.move(100));
// console.log(snake.sex) //私有private变量不允许在外部访问
// 类的继承
var Dog = /** @class */ (function (_super) {
    __extends(Dog, _super);
    function Dog(name, sex, age) {
        return _super.call(this, name, sex, age) || this;
    }
    Dog.prototype.bark = function () {
        // console.log('wang wang wang~~~')
        console.log('wang wang wang~~~', this.sex); //父类的受保护的变量可以在子类中使用
        // console.log('wang wang wang~~~', this.age) //报错,父类的私有变量不能在子类中使用
    };
    return Dog;
}(Animal));
var dog = new Dog('dog', '女', 22);
dog.bark();
console.log(dog.name);
console.log(dog.move(99));
// 类的私有private和protected变量不允许在外部访问
// console.log(snake.age)   //报错
// console.log(snake.sex)   //报错
// console.log(dog.sex)     //报错
